package org.azj.dbOperatorComponent;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import javax.sql.DataSource;

public class TransactionHelper extends TransactionTemplate implements IJobManager
{
	public TransactionHelper(DataSource dataSource)
	{
		super(new TransactionManager(dataSource));
	}
	
	@Override
	protected  List< List<HashMap<String, Object>> > doAllJobs() throws SQLException 
	{
		List< List<HashMap<String, Object>> > resultSets = 
				new ArrayList<List<HashMap<String, Object>>>();
		for (int i = 0; i < jobList.size(); i++)
		{
			List<HashMap<String, Object>> tmp = 
					jobList.get(i).doCommand(
						transactionManager.getDataSource());
	        
	        resultSets.add(tmp);
		}
		
		return resultSets;
	}
}
